package com.qianbao.finance.sync.modules.elasticsearch.service.impl;

import com.qianbao.finance.sync.common.annotation.DataSource;
import com.qianbao.finance.sync.common.annotation.SyncDataSource;
import com.qianbao.finance.sync.modules.elasticsearch.dao.BaseDao;
import com.qianbao.finance.sync.modules.elasticsearch.service.BaseDaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author：zgh
 * @DATE: 2018/6/22 12:52
 * @version: 0.0.1
 * @Description:
 */
@Service
public class BaseDaoServiceImpl implements BaseDaoService {

    @Autowired
    private BaseDao baseDao;
    @SyncDataSource
    @Override
    public Map<String, Object> selectByPK(String key, Object value, String databaseName, String tableName) {
        return baseDao.selectByPK(key,value,databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectByPKs(String key, List<Object> valueList, String databaseName, String tableName) {
        return baseDao.selectByPKs(key,valueList,databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectByPKsLockInShareMode(String key, List<Object> valueList, String databaseName, String tableName) {
        return baseDao.selectByPKsLockInShareMode(key,valueList,databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public Long count(String databaseName, String tableName) {
        return baseDao.count(databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public Long selectMaxPK(String key, String databaseName, String tableName) {
        return baseDao.selectMaxPK(key,databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public Long selectMinPK(String key, String databaseName, String tableName) {
        return baseDao.selectMinPK(key,databaseName,tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectByPKInterval(String key, long minPK, long maxPK, String databaseName, String tableName) {
        return baseDao.selectByPKInterval( key,  minPK,  maxPK,  databaseName,  tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectByPKIntervalLockInShareMode(String key, long minPK, long maxPK, String databaseName, String tableName) {
        return baseDao.selectByPKIntervalLockInShareMode( key,  minPK,  maxPK,  databaseName,  tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectByPKIntervalLockInShareModeStep(String key, long minPK, long stepSize, String databaseName, String tableName) {
        return baseDao.selectByPKIntervalLockInShareModeStep( key,  minPK,  stepSize,  databaseName,  tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectColumnsBySchemaAndTable(String databaseName, String tableName) {
        return baseDao.selectColumnsBySchemaAndTable( databaseName,  tableName);
    }
    @SyncDataSource
    @Override
    public List<Map<String, Object>> selectTableName(String databaseName) {
        return baseDao.selectTableName( databaseName);
    }
}
